package logic

import (
	"context"

	"worker/sse/internal/svc"
	"worker/sse/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetAllGroupLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGetAllGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAllGroupLogic {
	return &GetAllGroupLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *GetAllGroupLogic) GetAllGroup() (resp *types.GetAllGroupResp, err error) {
	resp = &types.GetAllGroupResp{}
	resp.Groups = l.svcCtx.SSE.GetAllGroup()
	return resp, nil
}
